import type { RouteRecordRaw } from 'vue-router'

const routes: RouteRecordRaw[] = [
    {
        path: '/',
        redirect: 'login'
    },
    {
        path: '/index',
        name: 'index',
        redirect: 'home',
        component: () => import('@/views/index.vue'),
        children: [{
            path: '/home',
            name: 'home',
            component: () => import('@/views/home/index.vue')
        },
        {
            path: '/robot',
            name: 'robot',
            component: () => import('@/views/robot/index.vue')
        },
        {
            path: '/notice',
            name: 'notice',
            component: () => import('@/views/notice/index.vue')
        },
        {
            path: '/manager',
            name: 'manager',
            redirect: 'manager-user',
            meta: { title: '管理员' },
            component: () => import('@/views/manager/index.vue'),
            children: [{
                path: '/manager-user',
                name: 'manager-user',
                meta: { title: '用户管理' },
                component: () => import('@/views/manager-user/index.vue')
            },
            {
                path: '/manager-creation',
                name: 'manager-creation',
                meta: { title: '作品管理' },
                component: () => import('@/views/manager-creation/index.vue')
            },
            {
                path: '/manager-notice',
                name: 'manager-notice',
                meta: { title: '公告管理' },
                component: () => import('@/views/manager-notice/index.vue')
            },

            {
                path: '/manager-comment',
                name: 'manager-comment',
                meta: { title: '评论管理' },
                component: () => import('@/views/manager-comment/index.vue')
            },
            {
                path: '/manager-log',
                name: 'manager-log',
                meta: { title: '日志管理' },
                component: () => import('@/views/manager-log/index.vue')
            }

            ]
        }
        ]
    },
    {
        path: '/create-article_question',
        name: 'create-article_question',
        component: () => import('@/views/create-article_question/index.vue')
    },
    {
        path: '/login',
        name: 'login',
        component: () => import('@/views/login/index.vue')
    },
    {
        path: '/details-article_question',
        name: 'details-article_question',
        component: () => import('@/views/details-article_question/index.vue')
    },
    {
        path: "/:catchAll(.*)",
        redirect: '/404'
    },
    {
        path: '/404',
        component: () => import('@/views/error/404.vue')
    }
]

export default routes